//
//  NSArray+Addtions.swift
//  B2BAutoziMall
//
//  Created by QeeGoo on 16/3/14.
//  Copyright © 2016年 qeegoo. All rights reserved.
//

import UIKit

extension NSArray
{
//    func indexOfCompareDictionary(compareDictionary: NSDictionary,keyString: String) -> Int
//    {
//        for i in 0 ..< self.count
//        {
//            let value = self.objectAtIndex(i)
//            if value.isKindOfClass(NSDictionary)
//            {
//                let dic = value as! NSDictionary
//                if dic.isEqualToCompareDictionary(compareDictionary, keyString: keyString)
//                {
//                    return i
//                }
//            }
//        }
//        return NSNotFound;
//    }
    public func jsonStringWithPrettyPrint() -> String
    {

        let jsonData = try! JSONSerialization.data(withJSONObject: self, options: JSONSerialization.WritingOptions.prettyPrinted )
        var jsonString = String(data: jsonData ,encoding: .utf8)
        APPLog(message: jsonString)
        jsonString = jsonString?.replacingOccurrences(of: "\n", with: "")
        
        return jsonString!
    }
}
